home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / arraysvcs.idb / usr / lib / array / ampi.z / ampi
Encoding:
Korn shell script  |  1997-02-07  |  1.3 KB  |  77 lines

  1. #!/bin/ksh
  2. #
  3. # Simple script to fire up the MPI launcher
  4. #
  5.  
  6. Launcher=/usr/bin/mpiview
  7. Usage="ampi <origin> <display> <cwd> <array name> [<envvar> <value>]..."
  8.  
  9. #
  10. # Make sure enough args were specified
  11. #
  12. if [ "$#" -lt 4 ]; then
  13.     echo "Incorrect number of arguments to $0"
  14.     echo $Usage
  15.     exit 1
  16. fi
  17.  
  18. #
  19. # Give command line args more meaningful names
  20. #
  21. Origin=$1
  22. DISPLAY=$2
  23. Cwd=$3
  24. Array=$4
  25. shift 4
  26.  
  27. #
  28. # Set some relevant environment variables that xwsh doesn't handle
  29. #
  30. eval HOME=~$LOGNAME
  31. export DISPLAY HOME
  32.  
  33. #
  34. # Set any caller-specified environment variables
  35. #
  36. while [ $# -gt 1 ]; do
  37.     VarName=$1
  38.     VarValue=$2
  39.  
  40.     if [ "$VarName" = "MPIRUN_DIR"  -a  "$VarValue" = "." ]; then
  41.         if [ "$Cwd" != "<>" ]; then
  42.             VarValue=$Cwd
  43.         fi
  44.     fi
  45.  
  46.     eval "export $VarName="'"'$VarValue'"'
  47.     shift 2
  48. done
  49.  
  50. #
  51. # If MPIview is not installed, quit now
  52. #
  53. if [ ! -x $Launcher ]; then
  54.     /usr/bin/X11/xconfirm             \
  55.         -c                \
  56.         -header "Launch MPI Job"    \
  57.         -t "Sorry, the MPI job launcher $Launcher is not installed" \
  58.         -icon error            \
  59.         > /dev/null
  60.     exit 1
  61. fi
  62.  
  63. #
  64. # Invoke MPIview from an xwsh so that console input & output are available
  65. #
  66. exec /usr/sbin/xwsh    \
  67.         -fn "-*-screen-medium-r-normal--12-*-*-*-m-70-iso8859-1" \
  68.         -geometry 80x24            \
  69.         -holdonerror            \
  70.         -iconic                \
  71.         -name MPIviewCons        \
  72.         -title "MPIview console"    \
  73.         -ut                \
  74.         -e $Launcher -array $Array
  75.  
  76. exit 0
  77.